package com.tsoj.tsojjudgeservice.judge.codesandbox;

import com.tsoj.tsojjudgeservice.judge.codesandbox.impl.ExampleCodeSandbox;
import com.tsoj.tsojjudgeservice.judge.codesandbox.impl.RemoteCodeSandbox;
import com.tsoj.tsojjudgeservice.judge.codesandbox.impl.ThirdCodeSandbox;

/**
 * 工厂模式去实现不同类型的代码沙箱的创建
 */
public class CodeSandboxFactory {

    public static CodeSandbox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
